
var projectName = '汽车租赁管理系统';
/**
 * 轮播图配置
 */
var swiper = {
	// 设定轮播容器宽度，支持像素和百分比
	width: '100%',
	height: '400px',
	// hover（悬停显示）
	// always（始终显示）
	// none（始终不显示）
	arrow: 'none',
	// default（左右切换）
	// updown（上下切换）
	// fade（渐隐渐显切换）
	anim: 'default',
	// 自动切换的时间间隔
	// 默认3000
	interval: 2000,
	// 指示器位置
	// inside（容器内部）
	// outside（容器外部）
	// none（不显示）
	indicator: 'outside'
}

/**
 * 个人中心菜单
 */
var centerMenu = [{
	name: '个人中心',
	url: '../' + localStorage.getItem('userTable') + '/center.html'
}, 
{
        name: '我的收藏',
        url: '../storeup/list.html'
}
]


var indexNav = [

{
	name: '营业门店',
	url: './pages/yingyemendian/list.html'
}, 
{
	name: '车辆信息',
	url: './pages/cheliangxinxi/list.html'
}, 
{
	name: '通知公告',
	url: './pages/tongzhigonggao/list.html'
}, 

]

var adminurl =  "http://localhost:8080/springbootqd7xr/admin/dist/index.html";

var cartFlag = false

var chatFlag = false




var menu = [{"backMenu":[{"child":[{"appFrontIcon":"cuIcon-addressbook","buttons":["新增","查看","修改","删除"],"menu":"用户","menuJump":"列表","tableName":"yonghu"}],"menu":"用户管理"},{"child":[{"appFrontIcon":"cuIcon-attentionfavor","buttons":["新增","查看","修改","删除"],"menu":"门店负责人","menuJump":"列表","tableName":"mendianfuzeren"}],"menu":"门店负责人管理"},{"child":[{"appFrontIcon":"cuIcon-similar","buttons":["新增","查看","修改","删除"],"menu":"城市信息","menuJump":"列表","tableName":"chengshixinxi"}],"menu":"城市信息管理"},{"child":[{"appFrontIcon":"cuIcon-goods","buttons":["新增","查看","修改","删除","查看评论"],"menu":"营业门店","menuJump":"列表","tableName":"yingyemendian"}],"menu":"营业门店管理"},{"child":[{"appFrontIcon":"cuIcon-brand","buttons":["新增","查看","修改","删除"],"menu":"车辆品牌","menuJump":"列表","tableName":"cheliangpinpai"}],"menu":"车辆品牌管理"},{"child":[{"appFrontIcon":"cuIcon-attentionfavor","buttons":["查看","修改","删除","查看评论"],"menu":"车辆信息","menuJump":"列表","tableName":"cheliangxinxi"}],"menu":"车辆信息管理"},{"child":[{"appFrontIcon":"cuIcon-clothes","buttons":["查看","删除"],"menu":"租赁车辆","menuJump":"列表","tableName":"zulincheliang"}],"menu":"租赁车辆管理"},{"child":[{"appFrontIcon":"cuIcon-attentionfavor","buttons":["查看","删除"],"menu":"用户取车","menuJump":"列表","tableName":"yonghuquche"}],"menu":"用户取车管理"},{"child":[{"appFrontIcon":"cuIcon-medal","buttons":["查看","删除"],"menu":"车辆续租","menuJump":"列表","tableName":"cheliangxuzu"}],"menu":"车辆续租管理"},{"child":[{"appFrontIcon":"cuIcon-medal","buttons":["查看","删除"],"menu":"用户还车","menuJump":"列表","tableName":"yonghuhaiche"}],"menu":"用户还车管理"},{"child":[{"appFrontIcon":"cuIcon-link","buttons":["查看","删除","报表"],"menu":"登记收费","menuJump":"列表","tableName":"dengjishoufei"}],"menu":"登记收费管理"},{"child":[{"appFrontIcon":"cuIcon-cardboard","buttons":["查看","删除"],"menu":"用户评价","menuJump":"列表","tableName":"yonghupingjia"}],"menu":"用户评价管理"},{"child":[{"appFrontIcon":"cuIcon-news","buttons":["查看","删除"],"menu":"退还押金","menuJump":"列表","tableName":"tuihaiyajin"}],"menu":"退还押金管理"},{"child":[{"appFrontIcon":"cuIcon-shop","buttons":["新增","查看","修改","删除"],"menu":"通知公告","menuJump":"列表","tableName":"tongzhigonggao"}],"menu":"通知公告管理"},{"child":[{"appFrontIcon":"cuIcon-paint","buttons":["查看","修改","删除"],"menu":"轮播图管理","tableName":"config"}],"menu":"系统管理"}],"frontMenu":[{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["查看"],"menu":"营业门店列表","menuJump":"列表","tableName":"yingyemendian"}],"menu":"营业门店模块"},{"child":[{"appFrontIcon":"cuIcon-phone","buttons":["查看","租赁车辆"],"menu":"车辆信息列表","menuJump":"列表","tableName":"cheliangxinxi"}],"menu":"车辆信息模块"},{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["查看"],"menu":"通知公告列表","menuJump":"列表","tableName":"tongzhigonggao"}],"menu":"通知公告模块"}],"hasBackLogin":"是","hasBackRegister":"否","hasFrontLogin":"否","hasFrontRegister":"否","roleName":"管理员","tableName":"users"},{"backMenu":[{"child":[{"appFrontIcon":"cuIcon-clothes","buttons":["查看","用户取车"],"menu":"租赁车辆","menuJump":"列表","tableName":"zulincheliang"}],"menu":"租赁车辆管理"},{"child":[{"appFrontIcon":"cuIcon-attentionfavor","buttons":["查看","车辆续租","用户还车"],"menu":"用户取车","menuJump":"列表","tableName":"yonghuquche"}],"menu":"用户取车管理"},{"child":[{"appFrontIcon":"cuIcon-medal","buttons":["查看","用户还车"],"menu":"车辆续租","menuJump":"列表","tableName":"cheliangxuzu"}],"menu":"车辆续租管理"},{"child":[{"appFrontIcon":"cuIcon-medal","buttons":["查看"],"menu":"用户还车","menuJump":"列表","tableName":"yonghuhaiche"}],"menu":"用户还车管理"},{"child":[{"appFrontIcon":"cuIcon-link","buttons":["查看","支付","审核","用户评价"],"menu":"登记收费","menuJump":"列表","tableName":"dengjishoufei"}],"menu":"登记收费管理"},{"child":[{"appFrontIcon":"cuIcon-cardboard","buttons":["查看","修改","删除"],"menu":"用户评价","menuJump":"列表","tableName":"yonghupingjia"}],"menu":"用户评价管理"}],"frontMenu":[{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["查看"],"menu":"营业门店列表","menuJump":"列表","tableName":"yingyemendian"}],"menu":"营业门店模块"},{"child":[{"appFrontIcon":"cuIcon-phone","buttons":["查看","租赁车辆"],"menu":"车辆信息列表","menuJump":"列表","tableName":"cheliangxinxi"}],"menu":"车辆信息模块"},{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["查看"],"menu":"通知公告列表","menuJump":"列表","tableName":"tongzhigonggao"}],"menu":"通知公告模块"}],"hasBackLogin":"是","hasBackRegister":"否","hasFrontLogin":"是","hasFrontRegister":"是","roleName":"用户","tableName":"yonghu"},{"backMenu":[{"child":[{"appFrontIcon":"cuIcon-goods","buttons":["新增","查看","修改","删除","查看评论"],"menu":"营业门店","menuJump":"列表","tableName":"yingyemendian"}],"menu":"营业门店管理"},{"child":[{"appFrontIcon":"cuIcon-attentionfavor","buttons":["新增","查看","修改","删除","查看评论"],"menu":"车辆信息","menuJump":"列表","tableName":"cheliangxinxi"}],"menu":"车辆信息管理"},{"child":[{"appFrontIcon":"cuIcon-clothes","buttons":["查看","删除","审核"],"menu":"租赁车辆","menuJump":"列表","tableName":"zulincheliang"}],"menu":"租赁车辆管理"},{"child":[{"appFrontIcon":"cuIcon-attentionfavor","buttons":["查看","删除","审核"],"menu":"用户取车","menuJump":"列表","tableName":"yonghuquche"}],"menu":"用户取车管理"},{"child":[{"appFrontIcon":"cuIcon-medal","buttons":["查看","删除","审核"],"menu":"车辆续租","menuJump":"列表","tableName":"cheliangxuzu"}],"menu":"车辆续租管理"},{"child":[{"appFrontIcon":"cuIcon-medal","buttons":["查看","删除","审核","缴费通知"],"menu":"用户还车","menuJump":"列表","tableName":"yonghuhaiche"}],"menu":"用户还车管理"},{"child":[{"appFrontIcon":"cuIcon-link","buttons":["查看","删除","报表"],"menu":"登记收费","menuJump":"列表","tableName":"dengjishoufei"}],"menu":"登记收费管理"},{"child":[{"appFrontIcon":"cuIcon-cardboard","buttons":["查看"],"menu":"用户评价","menuJump":"列表","tableName":"yonghupingjia"}],"menu":"用户评价管理"},{"child":[{"appFrontIcon":"cuIcon-news","buttons":["新增","查看","修改","删除","支付"],"menu":"退还押金","menuJump":"列表","tableName":"tuihaiyajin"}],"menu":"退还押金管理"}],"frontMenu":[{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["查看"],"menu":"营业门店列表","menuJump":"列表","tableName":"yingyemendian"}],"menu":"营业门店模块"},{"child":[{"appFrontIcon":"cuIcon-phone","buttons":["查看","租赁车辆"],"menu":"车辆信息列表","menuJump":"列表","tableName":"cheliangxinxi"}],"menu":"车辆信息模块"},{"child":[{"appFrontIcon":"cuIcon-explore","buttons":["查看"],"menu":"通知公告列表","menuJump":"列表","tableName":"tongzhigonggao"}],"menu":"通知公告模块"}],"hasBackLogin":"是","hasBackRegister":"是","hasFrontLogin":"否","hasFrontRegister":"否","roleName":"门店负责人","tableName":"mendianfuzeren"}]


var isAuth = function (tableName,key) {
    let role = localStorage.getItem("userTable");
    let menus = menu;
    for(let i=0;i<menus.length;i++){
        if(menus[i].tableName==role){
            for(let j=0;j<menus[i].backMenu.length;j++){
                for(let k=0;k<menus[i].backMenu[j].child.length;k++){
                    if(tableName==menus[i].backMenu[j].child[k].tableName){
                        let buttons = menus[i].backMenu[j].child[k].buttons.join(',');
                        return buttons.indexOf(key) !== -1 || false
                    }
                }
            }
        }
    }
    return false;
}

var isFrontAuth = function (tableName,key) {
    let role = localStorage.getItem("userTable");
    let menus = menu;
    for(let i=0;i<menus.length;i++){
        if(menus[i].tableName==role){
            for(let j=0;j<menus[i].frontMenu.length;j++){
                for(let k=0;k<menus[i].frontMenu[j].child.length;k++){
                    if(tableName==menus[i].frontMenu[j].child[k].tableName){
                        let buttons = menus[i].frontMenu[j].child[k].buttons.join(',');
                        return buttons.indexOf(key) !== -1 || false
                    }
                }
            }
        }
    }
    return false;
}
